package com.shwread.android.ui.dialog;

import android.app.ActionBar.LayoutParams;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.shwread.android.qysw10000243.R;


public class BookTicketTimeoutDialog
        extends
        Dialog
        implements
        android.view.View.OnClickListener
{
	private Context  context;
	private TicketDialogListener listener;
	private Button   pwdBtn,loginBtn;
	
	public BookTicketTimeoutDialog(Context  context,TicketDialogListener listener) {
		super(context, R.style.common_dialog);
		this.context = context;
		this.listener = listener;
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setCancelable(false);
	    getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
	    getWindow().setGravity(Gravity.CENTER_VERTICAL);
	    findViews();
	}
	private void findViews() {
		View view = LayoutInflater.from(context).inflate(R.layout.book_ticket_timeout_dialog, null);
		
		pwdBtn = (Button) view.findViewById(R.id.book_ticket_timeout_pwd_btn);
		loginBtn = (Button) view.findViewById(R.id.book_ticket_timeout_login_btn);
		setContentView(view);
		pwdBtn.setOnClickListener(this);
		loginBtn.setOnClickListener(this);
	}
	
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.book_ticket_timeout_pwd_btn:
				if(null != listener) listener.getPwd();
				dismiss();
				break;
			case R.id.book_ticket_timeout_login_btn:
				if(null != listener) listener.login();
				dismiss();
				break;
		}
	}
	
}
